<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>hello_react</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/react/16.8.4/umd/react.development.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/react-dom/16.8.4/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <style>
      .title {
        background-color: orange;
      }
    </style>
  </head>
  <body>
    <div id="test"></div>
    <script type="text/babel">
      /*
      1、虚拟DOM中的变量使用{}
      2、样式类名要用className
      3、内联样式要用{{}}
      4、只能有一个根标签
      5、标签必须闭合
      6、标签首字母小写，react认为是原生标签
        标签首字母大写，react认为是自定义组件标签
      */
      // 创建虚拟DOM
      let content = "Hello React";
      let VDOM = (
        <h1 className="title" style={{ color: "#fff" }}>
          {content}
          <span>hello world</span>
          <input type="text" />
        </h1>
      );
      // 渲染虚拟DOM
      ReactDOM.render(VDOM, document.getElementById("test"));
    </script>

    <!-- <script>
      let VDOM = React.createElement(
        "h1",
        {
          id: "name",
        },
        "hello world"
      );
      // 渲染虚拟DOM
      ReactDOM.render(VDOM, document.getElementById("test"));
    </script> -->
  </body>
</html>
